/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.supinfo.youfood.web.servlet.client;

import com.supinfo.youfood.entity.TableResto;
import com.supinfo.youfood.service.TableRestoService;
import java.io.IOException;
import java.io.PrintWriter;
import javax.ejb.EJB;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 *
 * @author Michael
 */
@WebServlet(name = "PreAcceuilClientServlet", urlPatterns = {"/PreAcceuilClient"})
public class PreAcceuilClientServlet extends HttpServlet {

    @EJB
    private TableRestoService tableRestoService;
    
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        
    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        Long id_table = Long.valueOf(request.getParameter("lst_tables"));
        TableResto tableResto = tableRestoService.findTableBy(id_table);
        request.getSession(true).setAttribute("currentTable", tableResto);
        
        response.sendRedirect("/YouFood/accueil");
    }
}
